#ifndef _sc95fx_H_
#define _sc95fx_H_

#include <SC95F8x3x_C.H>
#include <STDLIB.H>
#include "sc95f.h"

#define true 1
#define false 0

// /*!< Signed integer types  */
// typedef   signed char     int8_t;
// typedef   signed short    int16_t;
// typedef   signed long     int32_t;

// /*!< Unsigned integer types  */
// typedef unsigned char     uint8_t;
// typedef unsigned short    uint16_t;
// typedef unsigned long     uint32_t;


#define     __I     volatile const   /*!< defines 'read only' permissions     */
#define     __O     volatile         /*!< defines 'write only' permissions    */
#define     __IO    volatile         /*!< defines 'read / write' permissions  */

// typedef enum {FALSE = 0, TRUE = !FALSE} bool;

// typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus, BitStatus;

// typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;

// typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus;

// typedef enum {LOW = 0, HIGH = !LOW} PriorityStatus;

#define SET_BIT(SFR, BIT)				((SFR) |= (BIT))

#define CLEAR_BIT(SFR, BIT)			((SFR) &= ~(BIT))

#define READ_BIT(SFR, BIT)    	((SFR) & (BIT))

#define CLEAR_REG(SFR)        	((SFR) = (0x0))

#define WRITE_REG(SFR, VAL)   	((SFR) = (VAL))

#define BIT(x) ((uint32_t)((uint32_t)0x01U << (x)))
#define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))

#define IS_BIT_1(reg, bit1s) (((uint32_t)reg & (uint32_t)bit1s) == (uint32_t)bit1s)
#define IS_BIT_0(reg, bit0s) (((uint32_t)reg | (~(uint32_t)bit0s)) == (~(uint32_t)bit0s))

#endif